package org.example.api;

import lombok.extern.slf4j.Slf4j;
import org.example.service.ObjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Slf4j
@RestController
public class ObjectController {

    @Autowired
    private ObjectService objectService;

    @RequestMapping("/upload")
    public Object upload(MultipartFile file){

        try{

            return objectService.saveObject("/", file.getBytes());

        }catch (Throwable e){
            log.error("", e);

        }

        return "";

    }

}
